<!-- @format -->

<template>
	<div class="ma-content-block lg:flex justify-between p-4">
		<!-- CRUD 组件 -->
		<ma-crud :options="options" :columns="columns" ref="crudRef">
			
		</ma-crud>


		
	</div>
</template>
<script setup>
	import { ref, reactive } from "vue";
	import predictionPms from "@/api/prediction/predictionPms";
	import { Message } from "@arco-design/web-vue";
	import tool from "@/utils/tool";
	import * as common from "@/utils/common";
	import { request } from "@/utils/request.js";
	const crudRef = ref();
    // 转utc时间
    const formattedDate = (date) =>{
        let time = ""
        return time = new Intl.DateTimeFormat("zh-CN", {
            year: "numeric",
            month: "2-digit",
            day: "2-digit",
            hour: "2-digit",
            minute: "2-digit",
            second: "2-digit",
            hour12: false,  // 24小时制
        }).format(date)
        .replace(/\//g, "-")  // 替换 / 为 -
        .replace(/, /g, " ") // 替换逗号为空格
    }
	const options = reactive({
		id: "flyos_prediction_pms",
		rowSelection: {
			showCheckedAll: true,
		},
		pk: "id",
		operationColumn: false,
		operationColumnWidth: 200,
		formOption: {
			viewType: "modal",
			width: 600,
		},
		api: predictionPms.getList,
		afterRequest:(params)=>{
            console.log(params)
            params.map((item)=>{
                item.crossTime = formattedDate(new Date(item.crossTime))
                item.createTime = formattedDate(new Date(item.createTime))
                item.plateNoPicUri = 'https://117.172.206.47:4433' + item.plateNoPicUri
                item.vehiclePicUri = 'https://117.172.206.47:4433' + item.vehiclePicUri
            })
        }
	});

	const columns = reactive([
		{
			title: "车牌号",
			dataIndex: "plateNo",
			formType: "input",
            align: "center",
            search:true,
		},
        {
			title: "车牌号图片",
			dataIndex: "plateNoPicUri",
			formType: "upload",
            align: "center",
		},
        {
			title: "车牌颜色",
			dataIndex: "plateColor",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "蓝色", value: 0 },
                        { label: "黄色", value: 1 },
                        { label: "白色", value: 2 },
                        { label: "黑色", value: 3 },
                        { label: "绿色", value: 4 },
                        { label: "民航黑色", value: 5 },
                        { label: "其他颜色", value: 255 }
                    ]
                },
                translation: true,
            }
		},
        {
			title: "进出场",
			dataIndex: "vehicleOut",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "进场", value: 0 },
                        { label: "出场", value: 1 },
                    ]
                },
                translation: true,
            }
		},
        {
			title: "车辆类型",
			dataIndex: "vehicleType",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "其他车", value: 0 },
                        { label: "小型车", value: 1 },
                        { label: "大型车", value: 2 },
                        { label: "摩托车", value: 3 },
                    ]
                },
                translation: true,
            }
		},
        {
			title: "放行方式",
			dataIndex: "releaseWay",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "未开闸", value: 10 },
                        { label: "自动开闸", value: 11 },
                        { label: "人工开闸", value: 12 },
                        { label: "遥控器开闸", value: 13 },
                    ]
                },
                translation: true,
            }
		},
        {
			title: "放行模式",
			dataIndex: "releaseMode",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "禁止放行", value: 10 },
                        { label: "固定车包期", value: 1 },
                        { label: "临时车入场", value: 2 },
                        { label: "预约车入场", value: 3 },
                        { label: "离线出场", value: 10 },
                        { label: "缴费出场", value: 11 },
                        { label: "预付费出场", value: 12 },
                        { label: "免费出场", value: 13 },
                        { label: "非法卡不放行", value: 30 },
                        { label: "手动放行", value: 31 },
                        { label: "特殊车辆放行", value: 32 },
                        { label: "节假日放行", value: 33 },
                        { label: "群组放行", value: 35 },
                        { label: "遥控器开闸", value: 36 },
                    ]
                },
                translation: true,
            }
		},
        
        {
			title: "放行结果",
			dataIndex: "releaseResult",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "未放行", value: 0 },
                        { label: "正常放行", value: 1 },
                        { label: "离线放行", value: 2 },
                    ]
                },
                translation: true,
            }
		},
        {
			title: "车辆分类",
			dataIndex: "carCategory",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "黑名单", value: 9 },
                        { label: "固定车", value: 10 },
                        { label: "临时车", value: 11 },
                        { label: "预约车", value: 12 },
                        { label: "特殊车", value: 14 },
                    ]
                },
                translation: true,
            }
		},
        {
            title: "车辆图片",
			dataIndex: "vehiclePicUri",
			formType: "upload",
            align: "center",
        },
        {
			title: "车辆颜色",
			dataIndex: "vehicleColor",
			formType: "select",
            align: "center",
            dict:{
                data(){
                    return [
                        { label: "其他颜色", value: 0 },
                        { label: "白色", value: 1 },
                        { label: "银色", value: 2 },
                        { label: "灰色", value: 3 },
                        { label: "黑色", value: 4 },
                        { label: "红色", value: 5 },
                        { label: "深蓝色", value: 6 },
                        { label: "蓝色", value: 7 },
                        { label: "黄色", value: 8 },
                        { label: "绿色", value: 9 },
                        { label: "棕色", value: 10 },
                        { label: "粉色", value: 11 },
                        { label: "紫色", value: 12 },
                    ]
                },
                translation: true,
            }
		},
        {
			title: "通行时间",
			dataIndex: "crossTime",
            align: "center",
			formType: "date",
            width:140,
		},
        {
			title: "放行原因",
			dataIndex: "releaseReason",
            align: "center",
			formType: "select",
            width:180,
            dict:{
                data(){
                    return [
                        { label: "固定车自动放行", value: 100 },
                        { label: "临时车自动放行", value: 101 },
                        { label: "预约车自动放行", value: 102 },
                        { label: "一户多车自动放行", value: 103 },
                    ]
                },
                translation: true,
            }
		},
	]);

	
</script>
<script>
	export default { name: "prediction:pms" };
</script>

<style lang="less" scoped>
	.edit {
		padding: 0;
		::v-deep .arco-btn-icon {
			margin-right: 0;
		}
	}
</style>
